#ifndef xd3d9buffer_h_h_h_h_h
#define xd3d9buffer_h_h_h_h_h

#include "setup.h"


namespace XE	
{
	class xd3d9VertexBuffer :public xVertexHardBuffer
	{
	public:
		xd3d9VertexBuffer(UINT VertexCount,UINT VerteSize,LPDIRECT3DDEVICE9 pDevice,DWORD Usage = 0);
		~xd3d9VertexBuffer();

		 void* Lock() ;

		 void UnLock() ;

  
	   	HRESULT Resize(UINT vertexCount);

		 LPDIRECT3DVERTEXBUFFER9 Getd3d9VertexBuffer()const {return m_pd3d9Buffer;}

		// bool ReSize(UINT size) ;

	protected:

		LPDIRECT3DDEVICE9 m_pDevice;
		LPDIRECT3DVERTEXBUFFER9 m_pd3d9Buffer;
		DWORD m_Usage;




	};





	/*----------------------------------------------------------------------------------
	IndexBuffer--------------
	//---------------------------------------------------------------------------------*/

	class xd3d9IndexBuffer : public xIndexHardBuffer
	{
	public:
		xd3d9IndexBuffer(UINT indexCount,xIndexHardBufferType indextype,LPDIRECT3DDEVICE9 pDevice,DWORD Usage = 0);

		~xd3d9IndexBuffer();


		void* Lock() ;

		void UnLock() ;

		HRESULT Resize(UINT indexCount);

		LPDIRECT3DINDEXBUFFER9 Getd3d9Indexs()const {return m_pd3d9buffer;}
		

	protected:

		LPDIRECT3DDEVICE9 m_pDevice;
		LPDIRECT3DINDEXBUFFER9 m_pd3d9buffer;
		DWORD m_Usage;


	};

	class xd3d9VertexDeclaration : public xVertexDeclaration
	{
	public:

		xd3d9VertexDeclaration(LPDIRECT3DDEVICE9 pDevice);
		
		~xd3d9VertexDeclaration();

		LPDIRECT3DVERTEXDECLARATION9 Getd3d9VertexDec() const ;

	protected:

		LPDIRECT3DDEVICE9 m_pd3d9device;
	 mutable	LPDIRECT3DVERTEXDECLARATION9 m_pd3d9decl;



	};




	/*----------------------------------------------------------------------------------------------
	HardBufferManager
	//----------------------------------------------------------------------------------------------*/
	class xd3d9HardBufferManager :public xHardBufferManager
	{
	public:
		xd3d9HardBufferManager(LPDIRECT3DDEVICE9 pDevice);
		~xd3d9HardBufferManager();

protected:
		xVertexHardBuffer* CreateVertexHardBufferImplement(UINT vertexCount,UINT PreVertexSize,DWORD Usage = 0);

		 xIndexHardBuffer* CreateIndexHardBufferImplement(UINT indexCount,xIndexHardBufferType indexType,DWORD Usage = 0);

		  xVertexDeclaration* CreateVertexDeclarationImplement(); 


	
         LPDIRECT3DDEVICE9 m_pDevice;

	};






}














#endif